package com.hy.mydesktop.shared.business;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.hy.mydesktop.client.component.meta.GridColumnConfigModel;
import com.hy.mydesktop.client.mvc.core.builder.GridBuilderTemplate;
import com.hy.mydesktop.client.mvc.core.builder.WindowApplicationBuildTemplate;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentControllerMetaModel;
import com.hy.mydesktop.shared.persistence.domain.gxt.ItemOfAssociateToWindow;
import com.hy.mydesktop.shared.persistence.domain.gxt.constant.ComponentMetaDataConstants;

public class CargoSpaceTypeServices {


	
	public GxtComponentControllerMetaModel createDynamicWindowController()
	{
		String controllerMetaModelId="cargoSpaceTypeServices";		
		Map<String , Object> gridMap2=new HashMap<String, Object>();
		String formId="cargoSpaceTypeService";
		gridMap2=createGridMap2(controllerMetaModelId,formId, gridMap2);
		
		GxtComponentControllerMetaModel gxtComponentControllerMetaModel=
			WindowApplicationBuildTemplate.createSimpleWindowApplication_model1(
				controllerMetaModelId,"货架类型设置",formId,gridMap2);

		return gxtComponentControllerMetaModel;		

	}
	
	
	private Map<String, Object> createGridMap2(String controllerMetaModelId,String formId, Map<String, Object> gridMap2) {
		List<GridColumnConfigModel> columnConfigs = new LinkedList<GridColumnConfigModel>();		
		columnConfigs.add(new GridColumnConfigModel("NAME","名称",150));
		columnConfigs.add(new GridColumnConfigModel("DESCRIPTION","描述",300));
		gridMap2.put(ComponentMetaDataConstants.GRID_COLUMNCONFIG_MODELS,columnConfigs);
		
		List<ItemOfAssociateToWindow> childrenItems=new LinkedList<ItemOfAssociateToWindow>();
		/*//GxtToSeamServiceParameter g1=new GxtToSeamServiceParameter("positionTypeService" , "getAllPositonType" );
		GxtToSeamServiceParameter g1=new GxtToSeamServiceParameter(formId , "getPageOfPersistentEntities" );
		g1.setMethodArgumentsType(null);
		ItemOfAssociateToWindow itemOfAssociateToWindow = new ItemOfAssociateToWindow();
		itemOfAssociateToWindow.setGxtToSeamServiceParameter(g1);
		EventStructureMetaModel eventStructureMetaModel = new EventStructureMetaModel();
		eventStructureMetaModel.setRootControllerId("windowController_"+controllerMetaModelId);
		eventStructureMetaModel.setControllerId("gridSetModuleController_"+controllerMetaModelId);
		itemOfAssociateToWindow.setEventStructureMetaModel(eventStructureMetaModel);
		itemOfAssociateToWindow.setItemType(ComponentMetaDataConstants.MVC_ITEM_TYPE);
		itemOfAssociateToWindow.setRegisterEventType(new GxtAppEventType("0401"));*/
	
		childrenItems.add(GridBuilderTemplate.createItemForEditorPagingGrid(controllerMetaModelId, formId));
		gridMap2.put(ComponentMetaDataConstants.CHILDREN_ITEMS,  childrenItems) ;
		
		
		return gridMap2;
	}
	

}
